Skip to content

Parse ANSI parameters declaration #1160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2025
Merged

Parse ANSI parameters declaration #1160

merged 1 commit into from
May 30, 2025

Conversation

Anselmo95
Copy link
Contributor

Add changes to parse parameters inside #() for a module declaration.

src/lexer.l Outdated
@@ -505,6 +505,7 @@ BEFORE ?i:before
<UDP>{UDP_EDGE} { yylval.i64 = yytext[0]; return tUDPEDGE; }
<UDP>{UDP_INDICATOR} { yylval.str = xstrdup(yytext); return tUDPIND; }

<*>"#(" { TOKEN(tHASHLPAREN); }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think #( is a single token. It's shown with a space between it them the grammar in the standard (e.g. page 1138 of 1800-2017) and also here:

https://www.sigasi.com/tech/systemverilog.ebnf/#module-parameters-and-ports

Icarus Verilog and Verilator also both treat the # and ( as separate tokens.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks for the review I wasn't aware that they were separate tokens, I'll try to look better into the syntax and adjust the code. It's gonna take a bit of time though


static void p_list_of_param_declarations(vlog_node_t mod)
{
// parameter_port_list ::= ansi_param_assignments { , ansi_param_assignments }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using the System Verilog grammar rather than the traditional Verilog one

@nickg nickg merged commit a464013 into nickg:master May 30, 2025
13 checks passed
@Anselmo95 Anselmo95 deleted the ansiparams branch May 30, 2025 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants